package org.shilong.MLogic.Json.login;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.shilong.Model.UserInfoModel;

public class GetUserInfoLogic {

	private static JSONObject jObject = null;

	private static JSONArray jArr = null;

	private static List<UserInfoModel> mList = null;

	public static List<UserInfoModel> getRlt( Object req ){

		mList = null;

		mList = new ArrayList<UserInfoModel>();

		jObject = null;

		try {
			jObject = new JSONObject( (String)req );

			jArr = jObject.getJSONArray( "rlt" );

			for( int i = 0; i < jArr.length(); i++ ){

				JSONObject oo = jArr.getJSONObject( i );

				UserInfoModel bean = new UserInfoModel();

				bean.setAccess_token( oo.getString( "access_token" ));
				bean.setAccount_name( oo.getString( "account_name" ) );
				bean.setExpires_in( oo.getString("expire_in"));
				bean.setUid( oo.getString("weibo_id") );

				mList.add(bean);
			}


		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}


		return mList;
	}
}
